﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Markup;

namespace QuantumQuest
{
    public partial class QQPlanet:QQBody
    {
        
        protected Image _image;
        protected TransformGroup _transGroup;

        protected TranslateTransform _translate;
        protected RotateTransform _rotate;
        protected ScaleTransform _scale;
        
       
        
        public QQPlanet()
        {
            _isStationary = true;
            InitTransforms();

        }
        public QQPlanet(double mass, QQVector2 position)
        {
            _position = position;
            _mass = mass;
            _isStationary = true;

            InitTransforms();
        }
      
        public void SetImage(string path)
        {
            Uri uri = new Uri(path, UriKind.Relative);//*********relative or absolute??????????????????????????????????????????????????????????????
            ImageSource imgSrc = new System.Windows.Media.Imaging.BitmapImage(uri);
            _image.Source = imgSrc;            
        }
        
        private void InitTransforms()
        {
            //so when we change a transformation, do we have to run through this again, or is it taken care of?
            this.RenderTransformOrigin = new Point(0.5, 0.5);//transform about the center of the planet

            _transGroup = new TransformGroup();
            _translate = new TranslateTransform();
            _rotate = new RotateTransform();
            _scale = new ScaleTransform();

            _rotate.Angle = 360 - _heading.ThetaDeg;//so it says it wants it in degrees clockwise...so this should work?

            _transGroup.Children.Add(_translate);
            _transGroup.Children.Add(_rotate);
            _transGroup.Children.Add(_scale);

            this.RenderTransform = _transGroup;

        }
        
    }
}
